import {defineStore} from "pinia";
import {ref} from "vue";
import type {Category} from "@/types/category";

export const useCategoryStore = defineStore('category', () => {
    const categoryList = ref<Category[]>([]) // 分类数据
    const categoryColorList = ref<[{ color: string, img: string }]>([{} as { color: string, img: string }])
    return {
        categoryList,
        categoryColorList
    }
}, {
    persist: {
        storage: {
            setItem(key, value) {
                uni.setStorageSync(key, value)
            },
            getItem(key) {
                return uni.getStorageSync(key)
            },
        },
    },
})